package com.zoo.springbootinit.dasource;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zoo.springbootinit.model.dto.user.UserQueryRequest;
import com.zoo.springbootinit.model.vo.UserVO;
import com.zoo.springbootinit.service.UserService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
@Component
public class UserDataSourceAccessor implements DataSourceAccessor<UserVO> {
    @Resource
    UserService userService;

    @Override
    public Page<UserVO> getDataSource(String name, long pageNum, long pageSize) {
        UserQueryRequest userQueryRequest = new UserQueryRequest();
        userQueryRequest.setUserName(name);
        userQueryRequest.setCurrent(pageNum);
        userQueryRequest.setPageSize(pageSize);
        Page<UserVO> userVOPage = userService.listUserVoByPage(userQueryRequest);
        return userVOPage;
    }
}
